/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package trace;

/**
 *
 * @author phil
 */
public class TBranch {

    private int historyRegister;
    private int MASK;


    public TBranch(int bits) {
        this.historyRegister = 0;
        this.MASK = (1<<bits) - 1;
    }

    public int getHistoryRegister() {
        return historyRegister;
    }

    public void updateRegister(int outcome) {
        this.historyRegister = this.historyRegister << 1;
        this.historyRegister += outcome;
        this.historyRegister &= MASK;
    }

}
